lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

index.md (1953B)


      1 +++
      2 title = 'Principles of IO software'
      3 +++
      4 # Principles of IO software
      5 the concepts:
      6 
      7 - device independence:
      8     - IO software provides abstraction over actual hardware
      9     - programs shouldn't have to care about device particularities
     10 - uniform naming:
     11     - because if you have to type a unique 20 letter id to access a device you’ll give up
     12 - error handling:
     13     - errors should be handled closest to their source so we don’t have to give a crap
     14 - synchronous vs asynchronous IO:
     15     - programs don't want to deal with interrupts.
     16     - so OS turns async operations into blocking operations
     17     - then lower levels have to deal with interrupts
     18 - buffering:
     19     - networking: incoming packets have to be buffered
     20     - audio: buffering to avoid clicks
     21 
     22 the layers in practice:
     23 
     24 ![screenshot.png](0c612b134cd53709365f563b566a86ea.png)
     25 
     26 interrupt handler
     27 
     28 - device driver doesn't handle low-level interrupt directly
     29 - lowe-level handler is relatively generic
     30 - on linux, calls device driver-specific interrupt handler if registered
     31 - on minix, sends message to device driver that registered for interrupt
     32 
     33 device driver:
     34 
     35 - accepts abstract reqs from device-independent layer and transforms them into commands for the device
     36 - can queue new requests as necessary
     37 - usually needs to wait for completion of the request (IRQ)
     38 - checks for errors and answers requests from device-independent layer
     39 
     40 device independent IO software:
     41 
     42 - uniform interfacing for device drivers (driver nterface, naming (major/minor numbers), and protection
     43 - buffering: necessary for both character and block devices
     44 - error reporting: hardware-level, driver-level, etc.
     45 - allocing/deallocing dedicated devices (e.g. printers)
     46 - device-independent block size: unify blocks/characters across devices
     47 
     48 user-level IO software
     49 
     50 - single interface allowing user to access devices
     51 - in C: fopen, close, fflush, frpintf, and so on
     52 - safely multiplexes access to exclusive devices